package com.cloudwebrtc.voip.mediaengine.impl;

import com.cloudwebrtc.voip.mediaengine.RTCVoiceEngine;

public class RTCVoiceEngineImpl implements RTCVoiceEngine {
	//implement for VoiceEngine_JNI.cpp
	private long nativePtr = 0;
	private native int SetAECMode(long nativePtr, int enabled, int mode);
	private native int SetAGCMode(long nativePtr, int enabled, int mode);
	private native int SetNSMode(long nativePtr, int enabled, int mode);
	private native int SetMicVolume(long nativePtr, int volume);
	private native int SetSpeakerVolume(long nativePtr, int volume);
	private native int GetMicVolume(long nativePtr);
	private native int GetSpeakerVolume(long nativePtr);
	private native int SetLoudspeakerStatus(long nativePtr, boolean yesno);
	private native int SetRecordingDevice(long nativePtr, int index);
	private native int SetPlayoutDevice(long nativePtr, int index);
	private native String GetPlayoutDeviceName(long nativePtr, int index);
	private native String GetRecordingDeviceName(long nativePtr, int index);
	private native int GetNumOfRecordingDevices(long nativePtr);
	private native int GetNumOfPlayoutDevices(long nativePtr);
	private native int GetSpeechInputLevel(long nativePtr);
	
	public RTCVoiceEngineImpl(long aNativePtr)
	{
		nativePtr = aNativePtr;
	}
	@Override
	public int SetAECMode(int enabled, int mode) {
		return SetAECMode(nativePtr,enabled,mode);
	}

	@Override
	public int SetAGCMode(int enabled, int mode) {
		return SetAGCMode(nativePtr,enabled,mode);
	}

	@Override
	public int SetNSMode(int enabled, int mode) {
		return SetNSMode(nativePtr,enabled,mode);
	}

	@Override
	public int SetSpeakerVolume(int volume) {
		return SetSpeakerVolume(nativePtr,volume);
	}

	@Override
	public int SetMicVolume(int volume) {
		return SetMicVolume(nativePtr,volume);
	}

	@Override
	public int GetSpeakerVolume() {
		return GetSpeakerVolume(nativePtr);
	}

	@Override
	public int GetMicVolume() {
		return GetMicVolume(nativePtr);
	}

	@Override
	public int GetSpeechInputLevel() {
		return GetSpeechInputLevel(nativePtr);
	}
	
	@Override
	public int GetNumOfPlayoutDevices() {
		return GetNumOfPlayoutDevices(nativePtr);
	}
	
	@Override
	public int GetNumOfRecordingDevices() {
		return GetNumOfRecordingDevices(nativePtr);
	}
	
	@Override
	public String GetRecordingDeviceName(int index) {
		return GetRecordingDeviceName(nativePtr,index);
	}
	
	@Override
	public String GetPlayoutDeviceName(int index) {
		return GetPlayoutDeviceName(nativePtr,index);
	}
	
	@Override
	public int SetPlayoutDevice(int index) {
		return SetPlayoutDevice(nativePtr,index);
	}
	
	@Override
	public int SetRecordingDevice(int index) {
		return SetRecordingDevice(nativePtr,index);
	}
	
	@Override
	public int SetLoudspeakerStatus(boolean yesno) {
		return SetLoudspeakerStatus(nativePtr,yesno);
	}
}
